<template>
  <div class="liegoodlist">
    <div class="title">
      {{title}}
    </div>
    <div ref="wrapper" class="lie_goods_f">
      <div v-bind:style="{width: width + 'px' }" class="lie_goods">
        <div class="good" v-for='item in goods'>
          <div  class="items">
            <div @click="goInfo(item.typeid)" class="img">
              <img :src="item.img">
            </div>
            <div class="name">{{item.title}}</div>
            <div class="prize">￥{{item.prize}}</div>
            <div class="add"><van-icon  name="add-o" /></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import Bscroll from 'better-scroll'
  export default {
    name: "favourite",
    props: {
      title: String,
      goods: Array,

    },
    data(){
      return{
        width: 0
      }
    },
    methods:{
      goInfo(v){
        console.log(v)
        this.$router.push({path: '/category/uid?='+v})
      }
    },
    mounted() {
      this.width=this.goods.length * 140
      this.$nextTick(() => {
        this.scroll = new Bscroll(this.$refs.wrapper, {
          click: true,
          scrollX: true,
          scrollY: false,
          eventPassthrough: 'vertical'
        })
      })
    }
  }
</script>

<style scoped lang="less">
  .img {
    width: 130px;
    height: 140px;
    overflow: hidden;
    background-color: @_grey;
    line-height: 140px;
  }

  .img img {
    width: 100%;
    height: auto;

  }
  .items{
    /*margin-bottom: 5px;*/
    position: relative;
  }
  .add{
    position: absolute;
    width: 30px;
    height: 30px;
    bottom: 0px;
    right: 10px;
    color: @_green;
    font-size: 25px;

  }

  .liegoodlist {
    background-color: #fff;
    width: 100%;
    clear: both;

    height: 250px;
  }

  .liegoodlist .title {
    height: 36px;
    line-height: 36px;
    color: @_blk;
    font-size: 16px;
    padding-left: 10px;
    /*margin-bottom: 12px;*/
    position: relative;
  }

  .lie_goods_f {
    padding-left: 5px;
    padding-right: 5px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }

  .good {
    float: left;
    width: 130px;
    margin: 0 5px;
  }

  .name {
    overflow: hidden;
    line-height: 32px;

    /*margin: 10px 0;*/
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .title div {
    float: right;
    height: 20px;
    width: 20px;
    margin-right: 5px;
  }

  .prize {
    color: @_red;
    line-height: 32px;
    overflow: hidden;
  }
</style>
